package day3.Exer;


public class Clac {
    String brand;
    String color;
    double price;
    public void showinfo(){
        System.out.println("这个计算器牌子是"+brand+",颜色是"+color+",价格是"+price+"元。");
        System.out.println("是否开始使用？y/n");
    }
    public double add(double i, double j) {
        System.out.println(i+j);
        return i + j;
    }

    public double sub(double i, double j) {
        System.out.println(i-j);
        return i - j;
    }

    public double mult(double i, double j) {
        System.out.println(i*j);
        return i * j;
    }

    public double div(double i, double j) {
        if (j == 0) {
            System.out.println("错误。除数不能为0");
        } else {
            System.out.println(i/j);
            return i / j;
        }

        return i/j;
    }
    public double power(double i, int j){
        double amass=1;
        for (int k=1;k<=j;k++){
            amass*=k;
        }
        System.out.println(amass);
        return amass;
    }
}
